<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta content="telephone=no,email=no,address=no" name="format-detection" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<meta name="msapplication-tap-highlight" content="no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="is_webp" content="yes" />
		<title>提现</title>
		<meta name="Keywords" content="用户中心" />
		<meta name="Description" content="用户中心" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="__TMPL__Public/css/common.css" />
		<link rel="stylesheet" href="__TMPL__Public/css/user.css" />
		<link rel="stylesheet" href="__TMPL__Public/css/public.css" />
		<style>
			body,
			input,
			button,
			textarea,
			select,
			option {
				font-family: Helvetica, Tahoma, Arial, "Hiragino Sans GB", "Hiragino Sans GB W3", STXihei, STHeiti, "Microsoft YaHei", Heiti, SimSun, sans-serif;
			}
			
			.list-footer {
				background: red;
			}
			
			.list-footer a {
				color: #fff;
			}
			
			#add-address-div {
				display: none;
			}
			
			.addressmone1 .save_btn.ok .btn {
				background: red;
			}
			
			input {
				font: 13.3333px Arial;
			}
			
			#btn_submit {
				background: #f23030;
			}
			
			#rechargecardmodel-card_number-error {
				display: none;
			}
			.operat-tips .tips-info {
			   height: 300px;
			   overflow: auto;
			}
		</style>
	</head>

	<body>

		<div>
			<?php
				$agent = $_SERVER['HTTP_USER_AGENT'];
				if(strpos($agent,"Html5Plus") === false){
			?>
			<header>
				<div class="header">
					<div class="header-left">
						<a class="sb-back" href="{:U('user/center')}" title="返回"></a>
					</div>
					<div class="header-middle">提现</div>
					<div class="header-right">
						<aside class="show-menu-btn">
							<div id="show_more" class="show-menu">
								<a href="javascript:;"></a>
							</div>
						</aside>
					</div>
				</div>
			</header>
			<mtc_include file="Public:right_nav" />
			<?php
			}
			?>
			<div class="middle-content m-t-0">
				<div class="withdraw-top">
					<div class="total-money">
						<p>可提现金额（元）</p>
						<p>{$userinfo['money']}</p>
					</div>
					<div class="withdraw-top-r">
						<p>最低提现金额 <span style="color:red;font-weight: 800;"> {$web_tixian_user} </span>元</p>
					</div>
				</div>
					<!-- 卡号 -->
					<div class="form-group form-group-spe">
						<dl>
							<dt style="width: 60px;">
							<span>提现：</span>
							</dt>
							<dd style="padding-left: 50px;">
								<div class="form-control-box">
									<input type="number" id="money" class="form-control ipt pull-none m-r-10" value="{$userinfo['money']}" >
								</div>
								<span id="rechargecardmodel-card_number-error"  class="form-control-error"><i class="fa fa-warning"></i></span>

							</dd>
						</dl>
					</div>

					<div class="invalid"></div>
					<div class="submit-btn">
						<a class="btn-submit" id="btn_submit"  href="javascript:void(0)">提现</a>
					</div>
				
				<div class="operat-tips">
					<h4>余额记录</h4>
					<div class="tips-info" id="tablelist_append">
						<table width="100%" border="0" cellpadding="10" cellspacing="1" bgcolor="#fff" style="line-height: 40px;">
							<tbody class="info">
								<tr>
									<td width="40%" align="center" style="font-weight: 800;">类型</td>
									<td width="15%" align="center" style="font-weight: 800;">金额</td>
									<td width="40%" align="center" style="font-weight: 800;">时间</td>
								</tr>
							</tbody>
						</table>
			
										
					</div>
				</div>
			</div>
		</div>

		</span>

		</div>

		</form>
		</div>
		<!-- 底部 _end-->
		<section class="mask-div"></section>
		<script type="text/javascript" src="/themes/wnsc_moblie/newMobile/User/js/area/jquery.min.js"></script>
		<script type="text/javascript" src="__TMPL__Public/js/common.js"></script>
		<script src="/themes/wnsc_moblie/newMobile/User/login/js/mobile/layer.js"></script>
		<link rel="stylesheet" href="/themes/wnsc_moblie/newMobile/Shop/css/dropload.css" />
		<script src="/themes/wnsc_moblie/newMobile/Shop/css/dropload.js"></script>
		<script type="text/javascript">
		
			$(function(){
			
				var last = 0;
				var amount = 6;
				var html='';
				var url = "{:U('user/get_tixian')}";
				var c_height=document.body.clientHeight;
				var t_height=c_height-400;
				$("#tablelist_append").height(t_height);
				$('#tablelist_append').dropload({
					scrollArea: window,
					domDown: {
						domClass: 'dropload-down',
						domRefresh: '<div class="dropload-refresh">上拉加载更多</div>',
						domLoad: '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
						domNoData: '<div class="dropload-noData">已无数据</div>'
					},
					loadDownFn: function(me) {
						$.ajax({
							type: 'post',
							url: url,
							data: {
								last: last,
								amount: amount
							},
							dataType: 'json',
							success: function(data) {
								if(data == null) {
									me.noData();
									me.resetload();
								} else {
									$('.no-data-div').hide();
									$.each(data,function(key,value) {
										$('.info').append(value)
										html+=value
									});
									last = last + amount;
								}
								// 代码执行后必须重置
								me.resetload();
							}
						});
					}
				});

			})
			$(function(){
				var money={$userinfo.money|default="0"};
				var min_money={$web_tixian_user|default="0"};
				$('#btn_submit').click(function(){
					var tx_money=$('#money').val();
					if(tx_money<=0){
						layer.open({
						    content: '提现金额必须大于0'
						    ,skin: 'msg'
						    ,time: 2 //2秒后自动关闭
						});
						return;
					}
					var cha_money=tx_money-money;
					if(cha_money>0){
						layer.open({
						    content: '提现金额必须小于可提金额'
						    ,skin: 'msg'
						    ,time: 2 //2秒后自动关闭
						});
						return;
					}
					if(tx_money<min_money){
						layer.open({
						    content: '提现金额必须大于最低提现金额'
						    ,skin: 'msg'
						    ,time: 2 //2秒后自动关闭
						});
						return;

					}

					$.post('/user/get_money', {
						tx_money: tx_money,
					}, function(result) {
						if(result==0){
							layer.open({
							    content: '提现失败'
							    ,skin: 'msg'
							    ,time: 2 //2秒后自动关闭
							});
							return;
						}
						if(result==1){
							layer.open({
							    content: '提现已提交，等待审核'
							    ,skin: 'msg'
							    ,time: 2 //2秒后自动关闭
							});
							return;
						}
						if(result==2){
							layer.open({
							    content: '提现金额必须小于可提金额'
							    ,skin: 'msg'
							    ,time: 2 //2秒后自动关闭
							});
							return;
						}
						if(result==3){
							layer.open({
							    content: '提现金额必须大于最低提现金额'
							    ,skin: 'msg'
							    ,time: 2 //2秒后自动关闭
							});
							return;
						}
					}, "json");
					
				})
			})
		</script>

	</body>

</html>